import { createRouter, createWebHistory } from 'vue-router'

const Home = () => import('../views/Home.vue')
const ToolDetail = () => import('../views/ToolDetail.vue')
const CategoryList = () => import('../views/CategoryList.vue')
const CreateTool = () => import('../views/CreateTool.vue')

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/tool/:id',
    name: 'ToolDetail',
    component: ToolDetail,
    props: true
  },
  {
    path: '/categories',
    name: 'Categories',
    component: CategoryList
  },
  {
    path: '/category/:id',
    name: 'CategoryTools',
    component: Home,
    props: true
  },
  {
    path: '/create-tool',
    name: 'CreateTool',
    component: CreateTool
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: '/'
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router 